<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button id="next">+</button>
    <input type="text" id="num" value="1" />
    <button id="prev">-</button>
    <script>
      let next = document.querySelector('#next')
      let prev = document.querySelector('#prev')
      let num = document.querySelector('#num')
      next.addEventListener('click', function () {
        let txt = num.value
        txt++
        num.value = txt
      })
      prev.addEventListener('click', function () {
        let prv = num.value
        prv--
        num.value = prv
      })
    </script>
  </body>
</html>
